//index.js
//获取应用实例
var app = getApp()
var api = "https://forum.alexs.fun/json/"

Page({
  data: {
    /* 内容Body数据 */
    // 热门推荐
    hotList: [],
    // 正在直播
    liveList: [],
    // 番剧更新
    bangumiList: [],
    /* 滚动广告配置 */
    // 图片数据集合
    imgUrls: [],
    // 是否显示面板指示点
    indicatorDots: false,
    // 是否自动切换
    autoplay: true,
    // 自动切换时间间隔
    interval: 5000,
    // 滑动动画时长
    duration: 1000
  },
  onLoad: function () {

    this.getHotList("hotList.json")
    this.getLiveList("liveList.json")
    this.getBangumiList("bangumiList.json")
    this.getImgUrls("imgUrls.json")
  },
  getHotList: function (e) {
    var that = this;
    wx.request({
      url: api + e,
      method: "GET",
      success(res) {
        that.setData({
          hotList: res.data
        })
      }
    })
  },
  getLiveList: function (e) {
    var that = this;
    wx.request({
      url: api + e,
      method: "GET",
      success(res) {
        that.setData({
          liveList: res.data
        })
      }
    })
  },
  getBangumiList: function (e) {
    var that = this;
    wx.request({
      url: api + e,
      method: "GET",
      success(res) {
        that.setData({
          bangumiList: res.data
        })
      }
    })
  },
  getImgUrls: function (e) {
    var that = this;
    wx.request({
      url: api + e,
      method: "GET",
      success(res) {
        that.setData({
          imgUrls: res.data
        })
      }
    })
  },

})